Начиная с Python 3.0, при возникновении нового исключения внутри блока except перехваченное исключение автоматически сохраняется в атрибуте __context__ создаваемого исключения. В результате при выводе будут показаны оба исключения:
(most recent call last): File "test.py", line 2, in <module> 1 / 0 ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "test.py", line 4, in <module> raise ValueError('Zero!') ValueError: Zero!
Кроме того, вы можете явно указать причинное исключение, использовав конструкцию raise … from. Тогда в атрибут __cause__ нового исключения будет помещено исходное:
division_error = None
try: 1 / 0 except ZeroDivisionError as e: division_error = e
raise ValueError('Zero!') from division_error
(most recent call last): File "test.py", line 4, in <module> 1 / 0 ZeroDivisionError: division by zero
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "test.py", line 8, in <module> raise ValueError('Zero!') from division_error ValueError: Zero!
Начиная с Python 3.0, при возникновении нового исключения внутри блока except перехваченное исключение автоматически сохраняется в атрибуте __context__ создаваемого исключения. В результате при выводе будут показаны оба исключения:
(most recent call last): File "test.py", line 2, in <module> 1 / 0 ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "test.py", line 4, in <module> raise ValueError('Zero!') ValueError: Zero!
Кроме того, вы можете явно указать причинное исключение, использовав конструкцию raise … from. Тогда в атрибут __cause__ нового исключения будет помещено исходное:
division_error = None
try: 1 / 0 except ZeroDivisionError as e: division_error = e
raise ValueError('Zero!') from division_error
(most recent call last): File "test.py", line 4, in <module> 1 / 0 ZeroDivisionError: division by zero
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "test.py", line 8, in <module> raise ValueError('Zero!') from division_error ValueError: Zero!
Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.
In many cases, the content resembled that of the marketplaces found on the dark web, a group of hidden websites that are popular among hackers and accessed using specific anonymising software.“We have recently been witnessing a 100 per cent-plus rise in Telegram usage by cybercriminals,” said Tal Samra, cyber threat analyst at Cyberint.The rise in nefarious activity comes as users flocked to the encrypted chat app earlier this year after changes to the privacy policy of Facebook-owned rival WhatsApp prompted many to seek out alternatives.Библиотека Python разработчика | Книги по питону from id